<%--

<!------------------------------------------------------------------------------
 - Copyright 2006 CORE Solutions Limited
 - All rights reserved.
 - PROPRIETARY AND CONFIDENTIAL INFORMATION.
 - Use is subject to license terms.
 -
 - FUNCTION ID      :   CATALOG_OPTION
 - AUTHOR           :   Saint Peng
 - DATE CREATE      :   2006/01/05
 - DESCRIPTION      :   a MAINTENANCE CONTENT JSP file for the function, CODE
 -                  :
 -                  :
 -                  :
 -
 - MODIFICATION HISTORY:
 - DATE         AUTHOR          VERSION NO.         COMMENT
 - -----------  --------------  ------------------  -------------------
 - 2006/01/05   Saint Peng      1.0                 source is generated.
 -
 -
 -
------------------------------------------------------------------------------->

--%>
<%@ include file="/jsp/com/erp/app/common/jsp/directives_include.jsp"%>

<%@ page import="com.erp.app.setup.catalogOption.vo.CatalogOptionHdrVo"%>
<%@ page import="com.erp.app.setup.catalogOption.web.CatalogOptionMaintenanceAction"%>
<%@ page import="com.erp.app.util.web.TabInfo"%>

<%@ include file="/jsp/com/erp/app/common/jsp/html_include.jsp"%>

<jsp:useBean id="catalogOptionMaintenanceForm" scope="session" type="com.erp.app.setup.catalogOption.web.CatalogOptionMaintenanceForm" />

<script language="javascript">

	function doLoad() {
		<%
		if (CommonUtil.nullToString((String)session.getAttribute(ProjectConstants.SESSION_ALERT_AFTER_SAVE)).equals(ProjectConstants.GENERIC_YES)) {
			session.removeAttribute(ProjectConstants.SESSION_ALERT_AFTER_SAVE);
			out.println("alert('Records saved.');");
		}
		%>

		<%
		String lastAction = CommonUtil.nullToString(catalogOptionMaintenanceForm.getPageEvent());

		if (lastAction.equalsIgnoreCase(CatalogOptionMaintenanceAction.ACTION_EDIT_HDRDESC)) {
		   out.println(WebUtil.openSelectRemarkTextDo());
		} else if (lastAction.equalsIgnoreCase(CatalogOptionMaintenanceAction.ACTION_EDIT_DESC)) {
			out.println(WebUtil.openSelectRemarkTextDo());
		}
		%>
	}

</script>

<body onLoad="javascript:doLoad();">
<html:form action="/catalogOptionMaintenance">

<html:hidden property="pageEvent"/>
<html:hidden property="pageMode"/>
<html:hidden property="deleteIdx"/>
<html:hidden property="pageEventSrc"/>

<table class="table_button">

<tr>
	<td>
		<chtml:button form="catalogOptionMaintenanceForm" pageEvent="<%=CatalogOptionMaintenanceAction.ACTION_EXIT%>"
			styleClass="button1"/>
		<chtml:button form="catalogOptionMaintenanceForm" pageEvent="<%=CatalogOptionMaintenanceAction.ACTION_SEARCH%>"
			styleClass="button1"/>
		<chtml:button form="catalogOptionMaintenanceForm" pageEvent="<%=CatalogOptionMaintenanceAction.ACTION_SAVE%>"
			styleClass="button1"/>
		<chtml:button form="catalogOptionMaintenanceForm" pageEvent="<%=CatalogOptionMaintenanceAction.ACTION_REFRESH%>"
			styleClass="button1"/>
        <!--<chtml:button form="catalogOptionMaintenanceForm" pageEvent="<%=CatalogOptionMaintenanceAction.ACTION_PRINT_ENG%>"
			styleClass="button1"/>-->
		<!--<chtml:button form="catalogOptionMaintenanceForm" pageEvent="<%=CatalogOptionMaintenanceAction.ACTION_PRINT_CHN%>"
			styleClass="button1"/>-->
	</td>
</tr>

</table>

<html:errors />

<div id="tabsF"><ul><%

TableSchema ts = catalogOptionMaintenanceForm.getTs();

TabInfo[] tabInfos = new TabInfo[] {
	new TabInfo()
		.setFolderIdx(CatalogOptionMaintenanceAction.TAB_IDX_DOC)
		.setPageEvent(CatalogOptionMaintenanceAction.ACTION_CHANGE_FOLDER_DOC)
		.setTitle(ts.getDisplayWebLabelByObjectId("LBL_TAB_DOC"))
		.setHidden(false)
		.setTabJsp("CatalogOptionHdrTab.jsp"),
	new TabInfo()
		.setFolderIdx(CatalogOptionMaintenanceAction.TAB_IDX_DTL)
		.setPageEvent(CatalogOptionMaintenanceAction.ActionDelDetal)
		.setTitle(ts.getDisplayWebLabelByObjectId("LBL_TAB_DTL"))
		.setHidden(true)
		.setTabJsp("CatalogOptionDtlTab.jsp")
};

TabInfo currentTab = null;
for (int i = 0; i < tabInfos.length; ++i) {
	if (catalogOptionMaintenanceForm.getFolderIdx().equals(String.valueOf(tabInfos[i].getPageEventSrc()))) {
		currentTab = tabInfos[i];
	}
	if (tabInfos[i].isHidden()) continue;
	%><chtml:button useExtensions="true" uiType="tab" form="catalogOptionMaintenanceForm" pageEvent="<%=tabInfos[i].getPageEvent()%>" pageEventSrc="<%=tabInfos[i].getPageEventSrc()%>" /><%
}

%></ul></div><%
%><div class="titlebar"><span class="headertitletext"><%=currentTab.getTitle()%></span></div>
<jsp:include page="<%=tabInfos[0].getTabJsp()%>" flush="true"/>
<jsp:include page="<%=tabInfos[1].getTabJsp()%>" flush="true"/>
</html:form>
